package com.cqeec.waimai4.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.MybatisMapWrapperFactory;
import com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan("com.cqeec.waimai4.mapper")
public class MpConfig {
    @Bean
    public MybatisPlusInterceptor interceptor(){
// 创建分页拦截器
        MybatisPlusInterceptor interceptor =new MybatisPlusInterceptor();
        //添加分页拦截器，配置数据库类型
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
